import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import '../utils/constant.dart';

class MyDetailAppBar extends AppBar {
  final GlobalKey<NavigatorState> navigatorKey =
      new GlobalKey<NavigatorState>();

  MyDetailAppBar(
      {required BuildContext context,
      title,
      hasLeading = false,
      popWithParam,
      showSearch = false,
      showFilter = false,
      callBack = Function})
      : super(
            bottom: PreferredSize(
                child: Container(
                  color: Color(0xFFDDDDDD),
                  width: double.infinity,
                  height: 0.5,
                ),
                preferredSize: Size.fromHeight(0)),
            title: Text(
              title,
              style: TextStyle(color: Color(0xFF3C4353), fontSize: 18.sp),
            ),
            leading:
                IconButton(
                    icon: Container(
                      padding: EdgeInsets.all(3.0),
                      child: Image.asset(
                        Constant.IMG_BASE + 'ic_back.png',
                        width: 15.w,
                        height: 15.h,
                      ),
                    ),
                    onPressed: () {
                      if (popWithParam != null && popWithParam == true) {
                        Navigator.of(context).pop('11');
                      } else {
                        Navigator.of(context).pop();
                      }
                    },
                  ),
            actions: <Widget>[
              IconButton(onPressed: (){
                callBack('share');
              }, icon: Icon(Icons.share),color: Colors.grey)

            ],
            elevation: 0,
            backgroundColor: Colors.white,
            centerTitle: true);
}
